package com.zhen.controller;

import com.zhen.converter.DateEditor;
import com.zhen.domain.User;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@Controller
public class UserController {

    public static final Log LOGGER = LogFactory.getLog(UserController.class);

    @RequestMapping(value="/{formName}")
    public String loginForm(@PathVariable String formName){
        return formName;
    }

    @RequestMapping(value = "/register",method = RequestMethod.POST)
    public String register(@ModelAttribute User user,Model model){
        LOGGER.info(user);
        model.addAttribute(user);
        return "success";
    }
}
